﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;

namespace ObservadorPeplau.API
{
    public static class RegistryManager
    {
        public static RegistryKey GetOrCreateRegistryKey(string key)
        {
            return GetOrCreateRegistryKey(key, Application.UserAppDataRegistry);
        }
        public static RegistryKey GetOrCreateRegistryKey(string key, RegistryKey contextKey)
        {
            if (contextKey == null)
                return null;

            return contextKey.OpenSubKey(key, true) ??
                   contextKey.CreateSubKey(key);
        }

        public static RegistryKey GetRegistryKey(string key, RegistryKey contextKey)
        {
            if (contextKey == null)
                return null;
            return contextKey.OpenSubKey(key, true);
        }
    }
}
